<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>填写商品详细信息 - Powered by wemall</title>
<meta name="keywords" content="$!config.keywords" />
<meta name="description" content="$!config.description" />
<meta name="author" content="www.wemall.com">
<meta name="copyright" content="wemall Inc. All Rights Reserved">
<link href="$!webPath/resources/style/system/front/default/css/user.css" type="text/css" rel="stylesheet" />
 <link rel="stylesheet" href="$!webPath/resources/style/shop/default/css/yzs.css?v=1" />
<link href="$!webPath/resources/style/common/css/overlay.css" type="text/css" rel="stylesheet" />
<link rel="stylesheet" href="$!webPath/resources/editor/themes/default/default.css" />
<script src="$!webPath/resources/js/jquery-1.8.3.min.js"></script>
<script src="$!webPath/resources/js/jquery-ui-1.8.21.js"></script>
<script src="$!webPath/resources/js/jquery.shop.common.js"></script>
<script src="$!webPath/resources/js/jquery.shop.base.js"></script>
<script src="$!webPath/resources/js/jquery.validate.min.js"></script>
<script charset="utf-8" src="$!webPath/resources/editor/kindeditor.js"></script>
<script charset="utf-8" src="$!webPath/resources/editor/lang/zh_CN.js"></script>
<script src="$!webPath/resources/js/swfupload.js"></script>
<script src="$!webPath/resources/js/swfupload.queue.js"></script>
<script src="$!webPath/resources/layui/layui.all.js"></script>
<script>
  jQuery.validator.addMethod("transportId",
    function(value, element) {
        if (jQuery(':radio[name=goods_transfee][value=0]').attr('checked') && jQuery(':radio[name=transport_type][value=0]').attr('checked')){
	        	if (jQuery('#transport_id').val() == ''){
	        		return false;
	        	}else{
	        		return true;
	        	}
        }else{
        	return true;
        }}
    );
//options为编辑配置属性
var options = {
        cssPath : '$!webPath/resources/editor/plugins/code/prettify.css',
        filterMode : true,
		uploadJson:'$!webPath/seller/upload.htm',
		width : '860px',
		height:'400px',
		resizeType : 1,
		allowImageUpload : true,
		allowFlashUpload : true,
		allowMediaUpload : true,
		allowFileManager : false,
		syncType:"form",
		afterCreate : function() {
							var self = this;
							self.sync();
						},
		afterChange : function() {
							var self = this;
							self.sync();
						},
		afterBlur : function() {
							var self = this;
							self.sync();
						},
		items:['source', '|', 'fullscreen', 'undo', 'redo', 'print', 'cut', 'copy', 'paste',
			'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
			'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
			'superscript', '|', 'selectall', 'clearhtml','quickformat','|',
			'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
			'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image','flash', 'media', 'table', 'hr', 'emoticons', 'link', 'unlink', '|', 'about']
};

var swf_upload;
var photo_count=0;
var user_goods_class_count=2;
jQuery(document).ready(function() {
 var settings_object = {//定义参数配置对象
        upload_url : "$!webPath/seller/swf_upload.htm",
            flash_url : "$!webPath/resources/flash/swfupload.swf",
            file_post_name : "imgFile",
            post_params : {
              "user_id" : "$!user.id"
            },
            use_query_string : false,
            requeue_on_error : false,
            file_types : "$!imageSuffix",
            file_types_description: "商品图片",
            file_size_limit : "$!config.imageFilesize",
            file_upload_limit : 0,
            file_queue_limit : 0,
            debug : false,
            prevent_swf_caching : true,
            preserve_relative_urls : false,

            button_placeholder_id : "upload_imgs",
            button_image_url : "$!webPath/resources/style/common/images/upload.jpg",
            button_width : 160,
            button_height : 28,
            button_text : "<b></b> <span class='upload_text'>选择上传商品图片</span>",
            button_text_style : ".upload_text { color: #666666;font-size:12px;margin-left:40px; }",
            button_text_left_padding : 3,
            button_text_top_padding : 5,
            button_action : SWFUpload.BUTTON_ACTION.SELECT_FILES,
            button_disabled : false,
            button_cursor : SWFUpload.CURSOR.HAND,
            button_window_mode : SWFUpload.WINDOW_MODE.TRANSPARENT,
			file_dialog_start_handler:fileDialogStart,
			file_dialog_complete_handler:fileDialogComplete,
            upload_start_handler:upload_start_handler,
            upload_success_handler:uploadSuccess,
			upload_complete_handler:uploadComplete

    };
    swf_upload = new SWFUpload(settings_object);//实例化一个SWFUpload，传入参数配置对象
	#if($!obj.goods_main_photo)
	  photo_count=1;
	#end
	#if($!obj.goods_photos)
	  photo_count=photo_count+$!obj.goods_photos.size();
	#end
	function fileDialogStart(){
	  var stats = this.getStats();
	  stats.successful_uploads=photo_count;
	  this.setStats(stats);
	}
	function fileDialogComplete(numFilesSelected, numFilesQueued) {
	try {
	    var upload=0;
		var stats = this.getStats();
		var select_count=5-photo_count;
		if (select_count!=0&&numFilesSelected > select_count) {
		    alert("当前最多上传"+select_count+"张商品图片");
			this.cancelQueue();
			upload=1;
		}
		if(stats.successful_uploads>=5){
		    alert("已经上传5张图片,如要修改请先删除图片！");
			this.cancelQueue();
			upload=1;
		}
		if(upload==0){
		   this.startUpload();
		}
	} catch (ex)  {
        this.debug(ex);
	}
    }
	function upload_start_handler(){
	  jQuery("#upload_wait").show();
	}
	function uploadSuccess(file, serverData){//单个图片上传成功
	  var obj=eval("("+serverData+")");
	  photo_count++;
	  var stats = this.getStats();
	  if(obj.url!=""){
	    if(stats.successful_uploads==1){
	      jQuery("#goods_image_0").attr("src",obj.url);
	    }
	    jQuery("#goods_image_"+stats.successful_uploads).attr("src",obj.url);
	    jQuery("#goods_image_"+stats.successful_uploads).attr("image_id",obj.id);
	  }else{
	    alert("您的店铺图片空间不足，请选择升级店铺或删除相册图片！");
	  }
	  if(obj.remainSpace==0){
	     jQuery("#img_remain_size").html("空间大小不受限制");
	 }else{
	    jQuery("#img_remain_size").html(obj.remainSpace+"M");
	  }
	}
	function uploadComplete(file) {
	try {
		if (this.getStats().files_queued == 0) {
           jQuery("#upload_wait").hide();
		} else {
		   if(this.getStats.successful_uploads>=5){
			   this.cancelQueue();
		   }else{
		       this.startUpload();
		   }
		}
	} catch (ex) {
		this.debug(ex);
	}
}
 //默认赋值
  jQuery(":radio[name='goods_transfee'][value='$!{obj.goods_transfee}']").attr("checked",true);
  jQuery(":radio[name='goods_status'][value='$!{obj.goods_status}']").attr("checked",true);
  jQuery(":radio[name='goods_recommend'][value='$!{obj.goods_recommend}']").attr("checked",true);
  jQuery(":radio[name='inventory_type'][value='$!{obj.inventory_type}']").attr("checked",true);
  jQuery(":radio[name='lookStatus'][value='$!{obj.lookStatus}']").attr("checked",true);
  jQuery("#goods_brand_id").val("$!obj.goods_brand.id");
  #foreach($ugc in $obj.goods_ugcs)
    jQuery("#ugc_id_$!{velocityCount}").val("$!ugc.id");
  #end
  #foreach($spec in $obj.goods_specs)
    jQuery(":checkbox[id=spec_$!{spec.id}]").attr("checked",true);
  #end

    #if($!obj.inventory_type=="spec")
	var goods_spec_ids="";
	jQuery(":checkbox[id^=spec_]:checked").each(function(){
		goods_spec_ids=jQuery(this).val()+","+goods_spec_ids;
	});

	jQuery.post("$!webPath/seller/goods_inventory.htm",{"goods_spec_ids":goods_spec_ids},function(data){
		jQuery("#inventory_detail_content").append(data);
		jQuery("#inventory_detail").show();
		var inventory_detail='$!obj.goods_inventory_detail';
		var goods_inventory_detail=eval("("+inventory_detail+")");
		jQuery.each(goods_inventory_detail, function(index,item){
			jQuery("#inventory_details_count_"+item.id).val(item.count);
			jQuery("#inventory_details_price_"+item.id).val(item.price);
		});
	},"text");
  #end
  #if($!obj.goods_property)
  var data='$!obj.goods_property';
  var properties=eval("("+data+")");
  jQuery.each(properties,function(index,item){
      jQuery("#property_"+item.id).val(item.val);
  });
  #end
  //表单验证
  jQuery("#theForm").validate({
	ignore: "",
     rules: {
	        goods_class_id:{
			     required:true
			},
			 goods_serial:{
			     maxlength:20
			},
			goods_name:{
			     required:true,
				 minlength:3,
				 maxlength:50
			    },
			 goods_price:{
			    required:true,
				number:true,
				range:[0.01,1000000]
			 },
			 goods_weight:{
				number:true
				},
			goods_volume:{
				number:true
				},
			 store_price:{
			    required:true,
				number:true,
				range:[0.01,1000000]
			 },
			 goods_inventory:{
			    number:true,
				range:[1,1000000000]
			 },
			 transport_id:{transportId:true}
			},
     messages: {
	        goods_class_id:{required:"商品分类不能为空"},
			goods_serial:{maxlength:"输入字符长度不得超过20"},
			goods_name:{
			    required: "商品名不能为空",
			    minlength:"商品名最少为3个字符",
			    maxlength:"商品名最多为50个字符"
			  },
			goods_price:{
			    required:"商品原价不能为空",
				number:"商品原价只能是数字格式",
				range:"商品价格只能在0.01-1000000之间"
				},
			goods_weight:{
				number:"只能输入小数及整数"
				},
			goods_volume:{
				number:"只能输入小数及整数"
				},
			store_price:{
			    required:"店铺价格不能为空",
				number:"店铺价格只能是数字格式",
				range:"店铺价格只能在0.01-1000000之间"
				},
			goods_inventory:{
			    number:"商品库存只能为数字",
				range:"商品库存数量只能在0-1000000000之间"
			},
			transport_id:{transportId:"请选择一个运费模板"}
		  }

  });
  //
  jQuery(":input[id^=inventory_details_count_]").live("keyup",function(){
     var goods_inventory=0;
	 jQuery(":input[id^=inventory_details_count_]").each(function(){
		var reg = new RegExp("^[0-9]*$");
		if(!reg.test(jQuery(this).val())){
		    jQuery(this).val("0");
		}
		goods_inventory=parseInt(jQuery(this).val())+goods_inventory;
	 });
	 jQuery("#goods_inventory").val(goods_inventory);
  });
   //
  jQuery(":input[id^=inventory_details_price_]").live("keyup",function(){
	 jQuery(":input[id^=inventory_details_price_]").each(function(){
		//var reg = new RegExp("^[0-9]*$");
		var reg = new RegExp("^\\d+(\\.\\d{2}+)?$");
		if(!reg.test(jQuery(this).val())){
		    jQuery(this).val("0.0");
		}
	 });
  });

     //
  jQuery(":input[id='mail_trans_fee']").live("keyup",function(){
	 jQuery(":input[id='mail_trans_fee']").each(function(){
		var reg = new RegExp("^[0-9]*$");
		if(!reg.test(jQuery(this).val())){
		    jQuery(this).val("0.0");
		}
	 });
  });
     //
  jQuery(":input[id='express_trans_fee']").live("keyup",function(){
	 jQuery(":input[id='express_trans_fee']").each(function(){
		var reg = new RegExp("^[0-9]*$");
		if(!reg.test(jQuery(this).val())){
		    jQuery(this).val("0.0");
		}
	 });
  });
     //
  jQuery(":input[id='ems_trans_fee']").live("keyup",function(){
	 jQuery(":input[id='ems_trans_fee']").each(function(){
		var reg = new RegExp("^[0-9]*$");
		if(!reg.test(jQuery(this).val())){
		    jQuery(this).val("0.0");
		}
	 });
  });


  //
	jQuery(":radio[name=inventory_type]").live("click",inventory_type);
	jQuery(":checkbox[id^=spec_]").live("click",inventory_type);
  //
  editor = KindEditor.create('#goods_details',options);
  //
  jQuery(":radio[name='goods_transfee']").click(function(){
     var val=jQuery(this).val();
	 if(val==0){
	    jQuery("#buyer_transport_info").show();
	  }else{
	    jQuery("#buyer_transport_info").hide();
	  }
  });
  //
  jQuery("select[id^=ugc_id_]").live("change",function(){
     var the_ugc_id=jQuery(this).attr("id");
	 var the_val=jQuery(this).val();
	 jQuery("select[id!="+the_ugc_id+"]").each(function(){
	   if(jQuery(this).val()==the_val){
	     alert("已经存在该分类");
		 jQuery("#"+the_ugc_id).val("");
	   }
	 });
  });
});

function inventory_type(){
	var rv=jQuery(":radio[name=inventory_type]:checked").val();
  if(rv=="all"){
	jQuery("#inventory_detail_content").empty();
	jQuery("#inventory_detail").hide();
  }else{
	jQuery("#inventory_detail_content").empty();
	var goods_spec_ids="";
	jQuery(":checkbox[id^=spec_]:checked").each(function(){
		goods_spec_ids=jQuery(this).val()+","+goods_spec_ids;
	});

	jQuery.post("$!webPath/seller/goods_inventory.htm",{"goods_spec_ids":goods_spec_ids},function(data){
		jQuery("#inventory_detail_content").append(data);
		jQuery("#inventory_detail").show();
	},"text");
 }
}
function arrow_left(id){
  var i=parseInt(id);
  if(i>1){
    var temp_src=jQuery("#goods_image_"+(i-1)).attr("src");
	var temp_id=jQuery("#goods_image_"+(i-1)).attr("image_id");
	var the_src=jQuery("#goods_image_"+i).attr("src");
	var the_id=jQuery("#goods_image_"+i).attr("image_id");
	if(temp_id!=""&&temp_id!=undefined&&the_id!=""&&the_id!=undefined){
	  jQuery("#goods_image_"+(i-1)).attr("src",the_src);
	  jQuery("#goods_image_"+(i-1)).attr("image_id",the_id);
      jQuery("#goods_image_"+i).attr("src",temp_src);
	  jQuery("#goods_image_"+i).attr("image_id",temp_id);
	  if(i==2){
	  jQuery("#goods_image_0").attr("src",the_src);
	  jQuery("#goods_image_0").attr("image_id",the_id);
	  }
	}
  }
}
function arrow_right(id){
  var i=parseInt(id);
  if(i<5){
    var temp_src=jQuery("#goods_image_"+(i+1)).attr("src");
	var temp_id=jQuery("#goods_image_"+(i+1)).attr("image_id");
	var the_src=jQuery("#goods_image_"+i).attr("src");
	var the_id=jQuery("#goods_image_"+i).attr("image_id");
	if(temp_id!=""&&temp_id!=undefined&&the_id!=""&&the_id!=undefined){
	  jQuery("#goods_image_"+(i+1)).attr("src",the_src);
	  jQuery("#goods_image_"+(i+1)).attr("image_id",the_id);
      jQuery("#goods_image_"+i).attr("src",temp_src);
	  jQuery("#goods_image_"+i).attr("image_id",temp_id);
	  if(i==1){
	  jQuery("#goods_image_0").attr("src",temp_src);
	  jQuery("#goods_image_0").attr("image_id",temp_id);
	  }
	}
  }
}
function arrow_del(id){
  if(confirm("删除后不可恢复，是否继续？")){
    var stats = swf_upload.getStats();
    var image_id=jQuery("#goods_image_"+id).attr("image_id");
	jQuery.post("$!webPath/seller/goods_image_del.htm",{"image_id":image_id},function(data){
	    if(data.result==true){
		  jQuery("#img_remain_size").html(data.remainSpace+"M");
		  jQuery("#goods_image_"+id).attr("src","$!webPath/resources/style/system/front/default/images/usercenter/smallimg.jpg");
		  jQuery("#goods_image_"+id).attr("image_id","");
		  if(id==1){
		     jQuery("#goods_image_0").attr("src","$!webPath/resources/style/system/front/default/images/usercenter/img.jpg");
		  }
		  stats.successful_uploads--;
		  swf_upload.setStats(stats);
		  photo_count--;
		  var i=parseInt(id);
		  while(i<5){
		    var image_id=jQuery("#goods_image_"+(i+1)).attr("image_id");
			var image_src=jQuery("#goods_image_"+(i+1)).attr("src");

			if(image_id!=""){
			  jQuery("#goods_image_"+i).attr("image_id",image_id);
			  jQuery("#goods_image_"+i).attr("src",image_src);
			  if(i==1){
			    jQuery("#goods_image_0").attr("image_id",image_id);
			    jQuery("#goods_image_0").attr("src",image_src);
			  }
			  jQuery("#goods_image_"+(i+1)).attr("image_id","");
			  jQuery("#goods_image_"+(i+1)).attr("src","$!webPath/resources/style/system/front/default/images/usercenter/smallimg.jpg");
			}
			i++;
		  }
		}else alert("删除失败，请重新删除！");
	},"json");
  }
}
function arrow_remove(id){
    var stats = swf_upload.getStats();
    var image_id=jQuery("#goods_image_"+id).attr("image_id");
	jQuery("#goods_image_"+id).attr("src","$!webPath/resources/style/system/front/default/images/usercenter/smallimg.jpg");
	jQuery("#goods_image_"+id).attr("image_id","");
	if(id==1){
	    jQuery("#goods_image_0").attr("src","$!webPath/resources/style/system/front/default/images/usercenter/img.jpg");
	}
	stats.successful_uploads--;
	swf_upload.setStats(stats);
	photo_count--;
	var i=parseInt(id);
	while(i<5){
	   var image_id=jQuery("#goods_image_"+(i+1)).attr("image_id");
	    var image_src=jQuery("#goods_image_"+(i+1)).attr("src");
			if(image_id!=""){
			  jQuery("#goods_image_"+i).attr("image_id",image_id);
			  jQuery("#goods_image_"+i).attr("src",image_src);
			  if(i==1){
			    jQuery("#goods_image_0").attr("image_id",image_id);
			    jQuery("#goods_image_0").attr("src",image_src);
			  }
			  jQuery("#goods_image_"+(i+1)).attr("image_id","");
			  jQuery("#goods_image_"+(i+1)).attr("src","$!webPath/resources/style/system/front/default/images/usercenter/smallimg.jpg");
			}
			i++;
  }

}
/*Ajax分页*/
function ajaxPage(url,currentPage,obj){
  var ajax_page=jQuery(obj).parent().attr("ajax_page");
  if(ajax_page=="goods_transport"){
     jQuery.post("$!webPath/seller/goods_transport.htm",{"currentPage":currentPage,"ajax":true},function(data){
         jQuery("#ListForm").empty().html(data);
      },"html");
  }else{
     var ajax_type=jQuery(obj).parent().attr("ajax_type");
     var type=jQuery(obj).parent().attr("type");
     jQuery.post("$!webPath/seller/goods_img_album.htm",{"currentPage":currentPage,"type":type},function(text){
       jQuery(ajax_type).empty();
	   jQuery(ajax_type).append(text);
     },"text");
  }
}
function saveForm(){
  editor.sync();//同步编辑器的数据到textarea
  var image_ids="";
  for(var i=2;i<=5;i++){
	var image_id=jQuery("#goods_image_"+i).attr("image_id");
	if(image_id!=""&&image_id!=undefined){
	  image_ids=image_id+","+image_ids;
	}
  }
  jQuery("#image_ids").val(image_ids);
  var main_image_id=jQuery("#goods_image_1").attr("image_id");
  jQuery("#goods_main_img_id").val(main_image_id);
  var user_class_ids="";
  jQuery("select[id^=ugc_id_]").each(function(){
     if(jQuery(this).val()!=""){
	   user_class_ids=jQuery(this).val()+","+user_class_ids;
	 }
  });
  jQuery("#user_class_ids").val(user_class_ids);
  var goods_spec_ids="";
  jQuery(":checkbox[id^=spec_]:checked").each(function(){
     goods_spec_ids=jQuery(this).val()+","+goods_spec_ids;
  });
  jQuery("#goods_spec_ids").val(goods_spec_ids);
  var goods_properties="";
  jQuery("select[id^=property_]").each(function(){
    if(jQuery(this).val()!=""){
	   goods_properties=jQuery(this).attr("id").substring(9)+","+jQuery(this).val()+";"+goods_properties;
	}
  });
  jQuery("#goods_properties").val(goods_properties);
  var inventory_details="";
  jQuery("input[id^=inventory_details_count_]").each(function(){
	 var id=jQuery(this).attr("name");
	 var count=jQuery(this).val();
	 var price=jQuery("#inventory_details_price_"+id).val();
	 inventory_details=id+","+count+","+price+";"+inventory_details;
  });
  jQuery("#inventory_details").val(inventory_details);
  jQuery("#theForm").submit();
}
</script>
</head>
<body>
$!httpInclude.include("/top.htm")
<div class="main"> $!httpInclude.include("/head.htm")
  <div class="position">当前位置：<a href="$!webPath/index.htm">首页</a>><span>商品发布</span></div>
  <div class="navdetail"> <span class="navadd1 addcolor">选择商品所在分类</span> <span class="navadd2 white">填写商品详细信息</span> <span class="navadd3 addcolor">商品发布成功</span> </div>
  <div class="adddetail">
    <form action="$!webPath/seller/add_goods_finish.htm" method="post" enctype="multipart/form-data" name="theForm" id="theForm">
      <table width="1200" border="0" cellspacing="0" cellpadding="0" class="tabledetail" >
        <tr>
          <td colspan="2" class="tableh1">商品详细信息
            <input name="id" type="hidden" id="id" value="$!obj.id" /></td>
        </tr>
        <tr>
          <td width="95" align="right">商品分类：</td>
          <td><span>$!goods_class_info</span><span class="editbtn">
            <input name="goods_class_id" type="hidden" id="goods_class_id" value="$!{goods_class.id}" />
            <input name="goods_main_img_id" type="hidden" id="goods_main_img_id" />
            <input name="image_ids" type="hidden" id="image_ids" />
            <input name="user_class_ids" type="hidden" id="user_class_ids" />
            <input name="goods_spec_ids" type="hidden" id="goods_spec_ids" />
            <input name="goods_properties" type="hidden" id="goods_properties" />
            <input type="hidden" name="inventory_details" id="inventory_details" />
            <input name="edit_class" type="button" id="edit_class" value="编辑" style="cursor:pointer;" onclick="window.location.href='$!webPath/seller/add_goods_first.htm?id=$!{obj.id}'" />
            </span></td>
        </tr>
        <tr>
          <td align="right" valign="top">商品名称：</td>
          <td class="sptable"><span class="tabtxt1 size1">
            <input name="goods_name" type="text" id="goods_name" value="$!obj.goods_name" />
            </span><span class="hui2">商品标题名称长度至少3个字符，最长50个汉字</span></td>
        </tr>
        <tr>
          <td align="right" valign="top">商品原价：</td>
          <td class="sptable"><span class="tabtxt1 size2">
            <input name="goods_price" type="text" id="goods_price" value="$!obj.goods_price" />
            </span> <span class="hui2">商品原价必须是0.01~1000000之间的数字</span></td>
        </tr>
        <tr>
          <td align="right" valign="top">商品查看权限：</td>
          <td class="sptable">
          <label>
            <input name="lookStatus" type="radio" value="0" checked="checked" />
                      所有人
          </label>
          <label>
             <input type="radio" name="lookStatus" value="1" />会员
          </label>
          </td>
        </tr>
        <tr>
          <td align="right" valign="top">店铺价格：</td>
          <td class="sptable"><span class="tabtxt1 size2">
            <input name="store_price" type="text" id="store_price" value="$!obj.store_price" />
            </span> <span class="hui2">
            <ul class="tableli">
              <li>商品原价必须是0.01~1000000之间的数字</li>
              <li>若启用了库存配置，请在下方商品库存区域进行管理</li>
              <li>商品规格库存表中如有价格差异，店铺价格显示为价格区间形式</li>
            </ul>
            </span></td>
        </tr>
        #foreach($gs in ${goods_class.goodsType.gss})
        <tr id="gs_$!{gs.id}" gs_name="$!{gs.name}">
          <td align="right" valign="top">$!{gs.name}：</td>
          <td class="sptable"><ul class="color_chose">
              #foreach($gsp in $!gs.properties)
              <li> <span class="cc_sp1">
                <input name="spec_$!{gsp.id}" type="checkbox" id="spec_$!{gsp.id}" gs_id="$!gs.id"  gsp_val="$!gsp.value" value="$!gsp.id" />
                </span>
               <label for="spec_$!{gsp.id}">
                #if($!gs.type=="img")
                <span class="cc_sp2">
                <img src="$!webPath/$!{gsp.specImage.path}/$!{gsp.specImage.name}" width="16" height="16" />
                </span>
                #end
                <span class="cc_sp3">$!gsp.value</span>
                </label>
                 </li>
              #end
            </ul></td>
        </tr>
        #end
        <tr >
          <td align="right" valign="top">库存配置：</td>
          <td class="sptable">
          <label>
          <input type="radio" name="inventory_type" value="all" checked="checked" />
            全局配置
		  </label>
		  <label>
            <input type="radio" name="inventory_type" value="spec" />
            规格配置
		  </label>
			<span class="hui2">
			<ul class="tableli">
			<li>全局配置表示所有规格无单独库存、价格配置</li>
			<li>规格配置需要配置对应属性的库存、价格</li>
			</ul>
			</span>
		  </td>
        </tr>
        <tr id="inventory_detail" style="display:none;">
          <td align="right" valign="top">详细库存：</td>
          <td class="sptable"><div id="inventory_detail_content" style="width:98%;height:350px;overflow:auto;"></div></td>
        </tr>
        <tr >
          <td align="right" valign="top">商品库存：</td>
          <td class="sptable"><span class="tabtxt1 size2">
            <input name="goods_inventory" type="text" id="goods_inventory" value="$!obj.goods_inventory" />
            </span> <span class="hui2">
            <ul class="tableli">
              <li>商铺库存数量必须为1~1000000000之间的整数</li>
              <li>若启用了规格配置，则系统自动计算商品的总数，此处无需卖家填写</li>
            </ul>
            </span></td>
        </tr>
        <tr>
          <td align="right" valign="top">商品货号：</td>
          <td class="sptable"><span class="tabtxt1 size2">
            <input name="goods_serial" type="text" id="goods_serial" value="$!obj.goods_serial" />
            </span> <span class="hui2">
            <ul class="tableli">
              <li>商品货号是指卖家个人管理商品的编号，买家不可见</li>
              <li>最多可输入20个字符，支持输入中文、字母、数字、_、/、-和小数点</li>
            </ul>
            </span></td>
        </tr>
        <tr>
          <td align="right" valign="top">商品图片：</td>
          <script>
		    function photo_switch(clz,obj){
			 jQuery(".tabbody_ul li").removeClass("this");
			 jQuery(".tab_body_b").hide();
			 jQuery(obj).addClass("this");
			 if(clz=="tab_body_b"){
			 jQuery.post("$!webPath/seller/goods_img_album.htm",{"type":"goods_img_album"},function(text){
				jQuery(".tab_body_b").empty();
				jQuery(".tab_body_b").append(text);
			  },"text");
			 }
			 jQuery("."+clz).show();
			}
		  </script>
          <td><div class="tab_body">
              <ul class="tabbody_ul">
                <li class="this" style="cursor:pointer;" onclick="photo_switch('tab_body_a',this)">上传图片</li>
                <li style="cursor:pointer;" onclick="photo_switch('tab_body_b',this)">从用户相册选择</li>
              </ul>
              <div class="tabbodys">
                <div class="tab_body_b" style="display:none;"> </div>
                <div class="tab_body_a">
                  <div class="tabimg"> #if($!obj.goods_main_photo)
                    #set($img="$!webPath/$!{obj.goods_main_photo.path}/$!{obj.goods_main_photo.name}")
                    #else
                    #set($img="$!webPath/$!{config.goodsImage.path}/$!{config.goodsImage.name}")
                    #end
                    <div class="tabimgbig"><img id="goods_image_0" src="$!img" width="197" height="196" /></div>
                    <div class="tabimgcent">
                      <div class="tabupload"> <a href="javascript:void(0);"><span id="upload_imgs"></span><img id="upload_wait" style="display:none;" src="$!webPath/resources/style/common/images/loader.gif" /></a></div>
                      <div class="tabimgsmall">
                        <ul>
                          <li class="tabimgs"><img id="goods_image_1" image_id="$!obj.goods_main_photo.id" src="$!img" width="73" height="73" /></li>
                          <li class="taboper"><a href="javascript:void(0);"  title="左移" onclick="arrow_left('1');" class="tableft"><img src="$!webPath/resources/style/system/front/default/images/usercenter/arrow_left.png" width="16" height="16" /></a><a href="javascript:void(0);" title="从服务器删除" onclick="arrow_del('1');" class="tabdel"><img src="$!webPath/resources/style/system/front/default/images/usercenter/arrow_del.gif" width="15" height="13" /></a><a href="javascript:void(0);" title="从商品删除" onclick="arrow_remove('1');" class="tabdel"><img src="$!webPath/resources/style/system/front/default/images/usercenter/arrow_remove.gif" width="15" height="13" /></a><a href="javascript:void(0);" title="右移" onclick="arrow_right('1');" class="tabright"><img src="$!webPath/resources/style/system/front/default/images/usercenter/arrow_right.png" width="16" height="16" /></a></li>
                        </ul>
                        #set($img2="$!webPath/$!{config.goodsImage.path}/$!{config.goodsImage.name}")
                        #set($img2_id="")
                        #set($img3="$!webPath/$!{config.goodsImage.path}/$!{config.goodsImage.name}")
                        #set($img3_id="")
                        #set($img4="$!webPath/$!{config.goodsImage.path}/$!{config.goodsImage.name}")
                        #set($img4_id="")
                        #set($img5="$!webPath/$!{config.goodsImage.path}/$!{config.goodsImage.name}")
                        #set($img5_id="")
                        #foreach($img in $obj.goods_photos)
                        #if($velocityCount==1)
                        #set($img2="$!webPath/$!{img.path}/$!{img.name}")
                        #set($img2_id="$!img.id")
                        #end
                        #if($velocityCount==2)
                        #set($img3="$!webPath/$!{img.path}/$!{img.name}")
                        #set($img3_id="$!img.id")
                        #end
                        #if($velocityCount==3)
                        #set($img4="$!webPath/$!{img.path}/$!{img.name}")
                        #set($img4_id="$!img.id")
                        #end
                        #if($velocityCount==4)
                        #set($img5="$!webPath/$!{img.path}/$!{img.name}")
                        #set($img5_id="$!img.id")
                        #end
                        #end
                        <ul>
                          <li class="tabimgs"><img id="goods_image_2" image_id="$!img2_id" src="$!img2" width="73" height="73" /></li>
                          <li class="taboper"><a href="javascript:void(0);" title="左移" onclick="arrow_left('2');" class="tableft"><img src="$!webPath/resources/style/system/front/default/images/usercenter/arrow_left.png" width="16" height="16" /></a><a href="javascript:void(0);" title="从服务器删除" onclick="arrow_del('2');" class="tabdel"><img  src="$!webPath/resources/style/system/front/default/images/usercenter/arrow_del.gif" width="15" height="13" /></a><a href="javascript:void(0);" title="从商品删除" onclick="arrow_remove('2');" class="tabdel"><img src="$!webPath/resources/style/system/front/default/images/usercenter/arrow_remove.gif" width="15" height="13" /></a><a href="javascript:void(0);" title="右移" onclick="arrow_right('2');" class="tabright"><img src="$!webPath/resources/style/system/front/default/images/usercenter/arrow_right.png" width="16" height="16" /></a></li>
                        </ul>
                        <ul>
                          <li class="tabimgs"><img id="goods_image_3" image_id="$!img3_id" src="$!img3" width="73" height="73" /></li>
                          <li class="taboper"><a href="javascript:void(0);" title="左移" onclick="arrow_left('3');" class="tableft"><img src="$!webPath/resources/style/system/front/default/images/usercenter/arrow_left.png" width="16" height="16" /></a><a href="javascript:void(0);" title="从服务器删除" onclick="arrow_del('3');" class="tabdel"><img src="$!webPath/resources/style/system/front/default/images/usercenter/arrow_del.gif" width="15" height="13" /></a><a href="javascript:void(0);" title="从商品删除" onclick="arrow_remove('3');" class="tabdel"><img src="$!webPath/resources/style/system/front/default/images/usercenter/arrow_remove.gif" width="15" height="13" /></a><a href="javascript:void(0);" title="右移" onclick="arrow_right('3');" class="tabright"><img src="$!webPath/resources/style/system/front/default/images/usercenter/arrow_right.png" width="16" height="16" /></a></li>
                        </ul>
                        <ul>
                          <li class="tabimgs"><img id="goods_image_4" image_id="$!img4_id" src="$!img4" width="73" height="73" /></li>
                          <li class="taboper"><a href="javascript:void(0);" title="左移" onclick="arrow_left('4');" class="tableft"><img src="$!webPath/resources/style/system/front/default/images/usercenter/arrow_left.png" width="16" height="16" /></a><a href="javascript:void(0);" title="从服务器删除" onclick="arrow_del('4');" class="tabdel"><img src="$!webPath/resources/style/system/front/default/images/usercenter/arrow_del.gif" width="15" height="13" /></a><a href="javascript:void(0);" title="从商品删除" onclick="arrow_remove('4');" class="tabdel"><img src="$!webPath/resources/style/system/front/default/images/usercenter/arrow_remove.gif" width="15" height="13" /></a><a href="javascript:void(0);" title="右移" onclick="arrow_right('4');" class="tabright"><img src="$!webPath/resources/style/system/front/default/images/usercenter/arrow_right.png" width="16" height="16" /></a></li>
                        </ul>
                        <ul>
                          <li class="tabimgs"><img id="goods_image_5" image_id="$!img5_id" src="$!img5" width="73" height="73" /></li>
                          <li class="taboper"><a href="javascript:void(0);" title="左移" onclick="arrow_left('5');" class="tableft"><img src="$!webPath/resources/style/system/front/default/images/usercenter/arrow_left.png" width="16" height="16" /></a><a href="javascript:void(0);" title="从服务器删除" onclick="arrow_del('5');" class="tabdel"><img src="$!webPath/resources/style/system/front/default/images/usercenter/arrow_del.gif" width="15" height="13" /></a><a href="javascript:void(0);" title="从商品删除" onclick="arrow_remove('5');" class="tabdel"><img src="$!webPath/resources/style/system/front/default/images/usercenter/arrow_remove.gif" width="15" height="13" /></a><a href="javascript:void(0);" title="右移" onclick="arrow_right('5');" class="tabright"><img src="$!webPath/resources/style/system/front/default/images/usercenter/arrow_right.png" width="16" height="16" /></a></li>
                        </ul>
                      </div>
                    </div>
                    <div class="tabshowimg"> <img src="$!webPath/resources/style/system/front/default/images/usercenter/thumb.jpg" width="170" height="192" /></div>
                  </div>
                  <div class="warning">
                    <h2>最多可发布5张商品图片</h2>
                    <ul>
                      <li>支持多图片同时选取上传。支持$!imageSuffix格式上传，建议选择尺寸300x300以上、大小2M内的图片。</li>
                      <li>用户图空间剩余:<span style="color:#FF0000;" id="img_remain_size">#if($!{img_remain_size}==0)空间不限制大小#else$!{img_remain_size}M#end</span>，空间不足时将无法上传图片</li>
                    </ul>
                  </div>
                </div>
              </div>
            </div></td>
        </tr>
        <tr>
          <td align="right" valign="top">商品重量：</td>
          <td class="sptable"><span class="tabtxt1 size2">
            <input name="goods_weight" type="text" id="goods_weight" value="$!obj.goods_weight" />
            </span> <span class="hui2"> 单位：千克(Kg) </span>
            </td>
        </tr>
        <tr>
          <td align="right" valign="top">商品体积：</td>
          <td class="sptable"><span class="tabtxt1 size2">
            <input name="goods_volume" type="text" id="goods_volume" value="$!obj.goods_volume" />
            </span> <span class="hui2"> 单位：立方米(m³) </span>
            </td>
        </tr>
        <tr>
          <td rowspan="2" align="right" valign="middle">运费：</td>
          <td><label><input name="goods_transfee" type="radio" value="1" checked="checked" />
          卖家承担运费</label> </td>
        </tr>
        <tr>
          <td><label><input name="goods_transfee" type="radio" value="0" />
            买家承担运费</label>
            <script>
			jQuery(document).ready(function(){
			   jQuery(":radio[name=transport_type]").click(function(){
				   var val=jQuery(this).val();
				   if(val==0){
				     jQuery("#transport_template_select").show();
					 jQuery("#mail_trans_fee").attr("readonly","readonly");
					 jQuery("#express_trans_fee").attr("readonly","readonly");
					 jQuery("#ems_trans_fee").attr("readonly","readonly");
				   }else{
				     jQuery("#transport_template_select").hide();
					 jQuery("#mail_trans_fee").removeAttr("readonly");
					 jQuery("#express_trans_fee").removeAttr("readonly");
					 jQuery("#ems_trans_fee").removeAttr("readonly");
				   }
				});
			   #if($!obj.transport)
			     jQuery(":radio[name=transport_type][value=0]").attr("checked","checked");
				 jQuery("#transport_template_select").show();
			   #else
			     jQuery(":radio[name=transport_type][value=1]").attr("checked","checked");
				 jQuery("#transport_template_select").hide();
			   #end
			   #if($!obj.goods_transfee==0)
			      jQuery("#buyer_transport_info").show();
			   #end
			});
			</script>
            <div id="buyer_transport_info" style=" display:none;width:80%; background:#F8F8F8; border:1px solid #CCC; margin-top:10px;padding-left:20px;">
              <ul style="line-height:30px;">
                <li>
                  <label>
                    <input type="radio" name="transport_type" value="0" checked="checked" />
                    使用运费模板
                  </label>
                 <div id="transport_template_select" style="padding-left:30px;"><input type="hidden" value="$!obj.transport.id" name="transport_id" id="transport_id" />
                 <span style="color:#06C;" id="transport_template_name">$!{obj.transport.trans_name}</span>
                 <span style="display:block; width:70px; height:28px; text-align:center; border:#CCC solid 1px;">
                 <a href="javascript:void(0);" dialog_uri="$!webPath/seller/goods_transport.htm" dialog_title="选择运费模板" dialog_width="600" dialog_height="500" dialog_id="transport_template_frm">选择模板</a></span>
                 </div>
                </li>
                <li><label>
                    <input type="radio" name="transport_type" value="1" />
                    固定运费</label>
                    平邮 <input name="mail_trans_fee" type="text" id="mail_trans_fee" value="$!CommUtil.null2Float($!obj.mail_trans_fee)" size="10" />
                元,快递
                <input name="express_trans_fee" type="text" id="express_trans_fee" value="$!CommUtil.null2Float($!obj.express_trans_fee)" size="10" />
                元,EMS
                <input name="ems_trans_fee" type="text" id="ems_trans_fee" value="$!CommUtil.null2Float($!obj.ems_trans_fee)" size="10" />
                元
                </li>
              </ul>
          </div></td>
        </tr>
        <tr>
          <td colspan="2" class="tableh1">商品详情描述</td>
        </tr>
        <tr>
          <td align="right" valign="middle">商品品牌：</td>
          <td><select name="goods_brand_id" id="goods_brand_id">
              <option value="">请选择...</option>

			  #foreach($gb in $gbs)

              <option value="$!gb.id">$!gb.name</option>

  			  #end

            </select></td>
        </tr>
        #foreach($property in $goods_class.goodsType.properties)
        <tr>
          <td align="right" valign="top">$!{property.name}：</td>
          <td><select name="property_$!{property.id}" id="property_$!{property.id}">
              <option value="">请选择...</option>
 			  #foreach($info in $CommUtil.splitByChar("$!property.value",","))
              <option value="$!info">$!info</option>
			  #end
            </select></td>
        </tr>
        #end
        <tr>
          <td align="right" valign="top">商品描述：</td>
          <td><textarea name="goods_details" style="width:100%;height:400px;visibility:hidden;" id="goods_details">$!obj.goods_details</textarea>
            <script>
           function switch_editor_photo(){
			  var dis=jQuery(".editor_photo_detail").css("display");
			  if(dis=="none"){
				jQuery.post("$!webPath/seller/goods_img_album.htm",{"type":"goods_detail_album"},function(text){
				   jQuery(".editor_photo_detail").empty();
			  	   jQuery(".editor_photo_detail").append(text);
			    },"text");
				jQuery(".editor_photo_detail").show();
			  }else{
				jQuery(".editor_photo_detail").hide();
			  }
		   }
           </script>
            <div class="photoimg">
              <div class="addphoto"><a href="javascript:void(0);" onclick="switch_editor_photo();">插入相册图片</a></div>
              <div class="editor_photo_detail" style="display:none;"> </div>
            </div></td>
        </tr>
        <tr>
          <td colspan="2" class="tableh1">其他信息</td>
        </tr>
        <script>
		  function add_goods_class(){
		    var s="<select name='ugc_id_0' id='ugc_id_0'><option value=''>请选择...</option>#foreach($ugc in $ugcs)<option value='$!ugc.id'>$!ugc.className</option> #foreach($c_ugc in $ugc.childs) <option value='$!c_ugc.id'>&nbsp;&nbsp;$!c_ugc.className</option>#end #end </select>";
			s=s.replaceAll("ugc_id_0","ugc_id_"+user_goods_class_count);
			jQuery("#ugc_id_"+(user_goods_class_count-1)).after(s);
			user_goods_class_count++;
		  }
		</script>
        <tr>
          <td align="right" valign="top">本店分类：</td>
          <td><span> <span id="ugc_info"> #if(!$!obj||$!{obj.goods_ugcs.size()}==0)
            <select name="ugc_id_1" id="ugc_id_1">
              <option value="">请选择...</option>
			  #foreach($ugc in $ugcs)
              <option value="$!ugc.id">$!ugc.className</option>
			  #foreach($c_ugc in $ugc.childs)
              <option value="$!c_ugc.id">&nbsp;&nbsp;$!c_ugc.className</option>
			  #end
			  #end
            </select>
            #else
            #foreach($goods_ugc in $obj.goods_ugcs)
            <select name="ugc_id_$!{velocityCount}" id="ugc_id_$!{velocityCount}">
              <option value="">请选择本店分类...</option>
			  #foreach($ugc in $ugcs)
              <option value="$!ugc.id">$!ugc.className</option>
			  #foreach($c_ugc in $ugc.childs)
              <option value="$!c_ugc.id">&nbsp;&nbsp;$!c_ugc.className</option>
			  #end
			  #end
            </select>
            #end
            #end </span> </span><a class="button_common" href="javascript:void(0);" onclick="add_goods_class();">新增分类</a> <span class="hui2 tableli">
            <ul>
              <li>商品可以从属于店铺的多个分类之下,</li>
              <li>店铺分类可以由 "卖家中心 ->  商品管理 -> <a href="$!webPath/seller/usergoodsclass_list.htm">商品分类</a>" 中自定义 </li>
            </ul>
            </span></td>
        </tr>
        <tr>
          <td align="right" valign="top">商品发布：</td>
          <td class="prorelease"><span>
            <label>
            <input name="goods_status" type="radio" value="0" checked="checked" />
            &nbsp;立即发布
            </label>
            </span> <span>
            <label>
            <input name="goods_status" type="radio" value="1" />
            &nbsp;放入仓库
            </label>
          </span></td>
        </tr>
        <tr>
          <td valign="top" align="right">商品推荐：</td>
          <td class="prorelease"><span><strong>
            <label>
            <input name="goods_recommend" type="radio" value="true" checked="checked" />
            &nbsp;是
            </label>
            </strong><strong>
            <label>
            <input name="goods_recommend" type="radio" value="false" />
            &nbsp;否
            </label>
          </strong></span> <span class="hui2">被推荐的商品会显示在店铺首页</span></td>
        </tr>
        <tr>
          <td align="right" valign="top">SEO关键字：</td>
          <td class="sptable"><span class="tabtxt1 size1">
            <input name="seo_keywords" type="text" id="seo_keywords" value="$!obj.seo_keywords" />
            </span> <span class="hui2 noteswidth">SEO关键字 (keywords) 出现在商品详细页面头部的 Meta 标签中，
            用于记录本页面商品的关键字，多个关键字间请用半角逗号 "," 隔开</span></td>
        </tr>
        <tr>
          <td align="right" valign="top">SEO描述：</td>
          <td class="sptable"><span class="texttable">
            <textarea name="seo_description" cols="" rows="" id="seo_description">$!obj.seo_description</textarea>
            </span> <span class="hui2 noteswidth">SEO关键字 (keywords) 出现在商品详细页面头部的 Meta 标签中，
            用于记录本页面商品的关键字，多个关键字间请用半角逗号 "," 隔开</span></td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td><span class="submittable">
            <input name="" type="button" value="提交" onclick="saveForm();" style="cursor:pointer;"/>
            </span>
            <input name="goods_session" type="hidden" id="goods_session" value="$!goods_session" /></td>
        </tr>
      </table>
    </form>
  </div>
  $!httpInclude.include("/footer.htm")</div>
</body>
</html>
